package com.qf.consumer1.consumers;

import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

//@Component
////消费test主题下，tag为sync的消息。对于非sync的消息一律不消费
//@RocketMQMessageListener(topic = "test",consumerGroup = "test-group1",selectorExpression = "sync2")
public class Consumer3 implements RocketMQListener<Message> {
    @Override
    public void onMessage(Message message) {
        System.out.println("consumer3");
        try {
            System.out.println("消息内容:" + new String(message.getBody(),"utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        System.out.println("-----------------------");
    }
}
